import scrapy
 
from scrapyselenium.items import ScrapyseleniumItem
 
class JobSpider(scrapy.Spider):
    name = "job"
    allowed_domains = ["techlabplt.com"]
    start_urls = ["http://www.techlabplt.com:8080/BD-PC/zhaopin.html"]
 
    def parse(self, response):
        # print("返回的状态码信息为：", response.status)
        job_list = response.xpath("//*[@id='app']/ul/li")
 
        for job in job_list:
			  # 获取得到各个数据字段
            job_item = ScrapyseleniumItem()
            job_item['job_name'] = job.xpath("./div[1]/a/div[1]/span[1]/text()").extract_first()
            job_item['area'] = job.xpath("./div[1]/a/div[1]/span[2]/span/span").extract_first()
            job_item['salary'] = job.xpath("./div[1]/a/div[2]/span").extract_first()
            job_item['experiment'] = job.xpath("./div[1]/a/div[2]/ul/li[1]").extract_first()
            job_item['skills'] = job.xpath("./div[2]/ul/li[1]").extract_first()
            job_item['company_name'] = job.xpath("./div[1]/div/div[2]/h3").extract_first()
            job_item['company_type'] = job.xpath("./div[1]/div/div[2]/ul/li[1]").extract_first()
            job_item['company_type_boon'] = job.xpath("./div[2]/div").extract_first()
            # 输出职位名称
print("职位名称：", job_item['job_name'])
